package com.example.lock;

/**
 * @author xiejp on 2022/5/9
 */

import java.util.Collection;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * 阻塞队列
 * 1 两个数据结构:栈/队列
 * 1.1 栈 后进先出
 * 1.2 队列  先进先出
 * 1.3 总结
 * 2 阻塞队列
 * 2.1 阻塞 必要不阻塞/不得不阻塞
 * 3 how
 */
public class BlockingQueueDemo {

    public static void main(String[] args) {
        BlockingQueue<String> blockingQueue = new ArrayBlockingQueue<>(3);
        //System.out.println(blockingQueue.add("a"));
        //System.out.println(blockingQueue.add("b"));
        //System.out.println(blockingQueue.add("c"));
        //System.out.println(blockingQueue.add("d"));
        //System.out.println(blockingQueue.add("e"));
        //System.out.println(blockingQueue.remove());


    }
}
